/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.afraid.poison.common;

import java.util.Enumeration;
import java.util.Iterator;

/**
 *
 * @author Andreas Schnaiter <rc.poison@gmail.com>
 */
public class IterableEnumeration<T> implements Iterable<T> {

	private final Enumeration<T> enumeration;

	public IterableEnumeration(Enumeration<T> enumeration) {
		this.enumeration=enumeration;
	}

	public Iterator<T> iterator() {
		return new Iterator<T>() {

			public boolean hasNext() {
				return enumeration.hasMoreElements();
			}

			public T next() {
				return enumeration.nextElement();
			}

			public void remove() {
				throw new UnsupportedOperationException("Not supported yet.");
			}
		};
	}
}
